<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>

<script>

function validateName() {
	var txtName = $('tse_name');
	var msgName = $('msgName');

	if (txtName.value == '') {
		msgName.innerText = 'Bạn cần nhập tên.';
		msgName.style.display = 'block';
		return false;
	}
	
	msgName.style.display = 'none';
	return true;
}

</script>

<input type="hidden" name="mode" value="editInfo"></input>
<p><label>Nội dung: <input type="text" name="tse_text" 
		value="${(empty param.tse_name) ? test.name : param.tse_name}"></input></label>
	<span id="msgName" style='${(empty nameErr) ? "none" : "block"}'>${nameErr}</span>
</p>
<p><label>Thứ tự: 
	<select name="tse_order">
	<c:forEach items="${test.sections}" var="item">
		<c:if test="${item != section}">
			<option value="${item.order}">
				${item.order} (${fn:substring(item.text, 0, 15)})
			</option>
		</c:if>
	</c:forEach>
	</select>
</label></p>
<p><button type="submit" name="tse_submit" value="update">Lưu</button>
<button type="button" onclick="location.href='${scriptPath}?action=test.view&id=${test.id}'">Thôi</button></p>
